//
//  CmtNewModel.m
//  Products_B
//
//  Created by lanou on 16/5/30.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "CmtNewModel.h"

@implementation CmtNewModel

+(NSMutableArray *)setModelWithJSdic:(NSDictionary *)jsdic{

    NSMutableArray *modelArray = [NSMutableArray arrayWithCapacity:10];

    NSDictionary *dataDic = jsdic[@"data"];
    NSArray *dataArray = dataDic[@"data"];
    for (NSDictionary *dataDataDic in dataArray) {
        CmtNewModel *model = [[CmtNewModel  alloc]init];
        [model setValuesForKeysWithDictionary:dataDic];
        [model setValuesForKeysWithDictionary:dataDataDic];
         [model setValuesForKeysWithDictionary:jsdic];
        NSArray *dix = dataDataDic[@"topics"];
        for (NSDictionary *d in dix) {
            model.top_id = d[@"id"];
            model.post_id = d[@"post_id"];
            model.topic_id = d[@"topic_id"];
            model.topic_name = d[@"topic_name"];
        }
        [modelArray addObject:model];
    }
    return modelArray;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
   
    if ([key isEqualToString:@"id"]) {
        __id = value;
    }
}

@end
